home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / xcmd / xrulesde.sit / Xrules™ Demo / card_23148.txt < prev    next >
Encoding:
Text File  |  1991-06-24  |  2.4 KB  |  75 lines

  1. -- card: 23148 from stack: in
  2. -- bmap block id: 23542
  3. -- flags: 4000
  4. -- background id: 7992
  5. -- name: 6-Processing Daemons
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 01
  10. -- high flags: 0007
  11. -- rect: left=2 top=24 right=311 bottom=510
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 22
  16. -- text size: 10
  17. -- style flags: 0
  18. -- line height: 13
  19. -- part name: 
  20.  
  21.  
  22. -- part 3 (button)
  23. -- low flags: 00
  24. -- high flags: 0000
  25. -- rect: left=256 top=314 right=337 bottom=281
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 1013 / 1013
  28. -- text alignment: 1
  29. -- font id: 0
  30. -- text size: 12
  31. -- style flags: 0
  32. -- line height: 16
  33. -- part name: Next
  34. ----- HyperTalk script -----
  35. on mouseUp
  36.   go to next card
  37. end mouseUp
  38.  
  39.  
  40.  
  41. -- part contents for card part 1
  42. ----- text -----
  43. Daemons are processed as a result of asserting facts.  The system handles daemons in a manner similar to the way that it handles rules when forward chaining.  When a fact is asserted, all daemons using that fact are examined whether the fact was asserted by a rule, by the "putIntoFact" XCMD, or by another daemon.  The daemons are processed in a depth first manner in the order that they appear in the rule base.  The following example illustrates the search order:
  44.  
  45.      rule x
  46.      if 
  47.        fact a
  48.      then 
  49.        put 1 into fact d -- assume fact d was asserted
  50.  
  51.      daemon d1
  52.      when 
  53.        fact d = 1        -- daemon 1 uses d and will be examined
  54.      then                --   first
  55.        put 2 into fact e -- the daemon will fire, asserting fact e
  56.                          --  and causing daemon 3 to be examined
  57.      daemon d2
  58.      when 
  59.        fact d = 1        -- daemon 2 will be examined after 
  60.      then                --   daemon 3
  61.        put 3 into fact f
  62.  
  63.      daemon d3
  64.      when 
  65.        fact e = 2        -- daemon 3 will be examined 
  66.      then                --  second because it uses fact e. 
  67.        put 4 into fact g --  If no more daemons use fact e,
  68.                          --   the system will resume the search
  69.                          --   for daemons using fact d
  70.  
  71. Note that daemons can never directly alter the search strategy, even when backward chaining.  If the system encounters a fact that is not asserted while processing a daemon, it simply ceases processing of the daemon.
  72.  
  73. Note also that all daemons using a fact are examined every time a value is assigned to the fact, even if that value is null ("").
  74.  
  75.